$(document).ajaxSend(function(e, xhr, opt) {
    let token = localStorage.getItem("user_token");
    xhr.setRequestHeader("request_user_token", token);
});

function logout() {
    localStorage.removeItem("user_token");
    location.href = "blog_list.html";
}

function getUserInfo(url) {
    $.ajax({
        url: url,
        type: "get",
        success: function(result) {
            if(result.status == "SUCCESS") {
                let data = result.data;
                console.log(data);
                $(".container .left .card h3").text(data.userName);
                $(".container .left .card a").attr("href", data.githubUrl);
            }
            else {
                $(".container .left .card h3").text(result.errMsg);
            }
        }
    });
}